/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package DAO;

import Model.Langue;
import java.util.List;
import org.hibernate.Session;
import org.hibernate.SessionFactory;

/**
 *
 * @author Anthares
 */
public class LangueManager extends BaseManager {
    public LangueManager(SessionFactory factory, String locale) {
        super(factory, locale);
    }

    public List<Langue> getAllLangues() {
        Session sess = factory.openSession();
        List<Langue> list = (List<Langue>) sess.getNamedQuery("Langue.findAll").list();
        sess.close();
        return list;
    }

    public Langue getLangueById(String id) {
        Session sess = factory.openSession();
        Langue lang = (Langue) sess.getNamedQuery("Langue.findByLangId").setString("langId", id).uniqueResult();
        sess.close();
        return lang;
    }
}
